let moiblePwd = async function(ctx, next) {
    let body = ctx.request.body;
    let code = '';
    let data = '';
    let msg = '';
    if (!body.mobile) {
        code = global.returnData.error.code;
        msg = '手机号码不能为空';
        data = '';
        ctx.body = {code, data, msg}
    } if (body.mobile && !global.validators.mobile.reg.test(body.mobile)) {
        code = global.returnData.error.code;
        msg = global.validators.mobile.message;
        data = '';
        ctx.body = {code, data, msg}
    } else if (!body.password) {
        code = global.returnData.error.code;
        msg = '密码不能为空';
        data = '';
        ctx.body = {code, data, msg}
    } else if (body.password && !global.validators.password.reg.test(body.password)) {
        code = global.returnData.error.code;
        msg = global.validators.password.message;
        data = '';
        ctx.body = {code, data, msg}
    } else {
        await next()
    }
}

module.exports = {
    moiblePwd
}